# Jea
import serial, resource, time, os
gps=serial.Serial("/dev/cuaU0", 38400, timeout=1)

#limit resource
#resource.setrlimit(resource.RLIMIT_CPU, (1,1))
breath = 0
nmea= ""
while ( 1 ):
    #gps.open()
    nmea = gps.readline()
    
    #gps.flush()
    #pid = os.getpid()
    #cpu_obso = os.times() # obsolete, use resource
    
    cpu = resource.getrusage(resource.RUSAGE_SELF)
    
    cpuuser = cpu.ru_utime
    cpusys  = cpu.ru_stime
    
    #print cpu_obso, "usermode=",cpuuser, "sysmode=",cpusys
    
    #time.sleep(0.1)
    
#   if breath == 1:
#	breath = 0
#	cpusys -= 1
    
#    if cpusys > 1.0:
#	time.sleep(1)
#	print "Breathing..."
#	breath = 1
    
gps.close()
